from pydantic import BaseModel
from typing import Optional, Any
from datetime import datetime


class MessageRequest(BaseModel):
    topic: str
    message: str
    key: Optional[str] = None


class MessageResponse(BaseModel):
    success: bool
    message: str
    topic: str
    partition: Optional[int] = None
    offset: Optional[int] = None


class ConsumedMessage(BaseModel):
    topic: str
    partition: int
    offset: int
    key: Optional[str]
    value: str
    timestamp: datetime